package edu.towson.greenteam.table;

import edu.towson.greenteam.order.Order;
import java.util.ArrayList;
import java.util.Observable;
import java.util.Observer;

public class Table implements Observer 
{

	private int id;
	private int numSeats;
	private boolean isOccupied;
	private int pin;
        private ArrayList<Order> orders;
	
	public Table() {
		this.isOccupied = false;
                orders = new ArrayList<Order>();
	}
	
	public Table(int id) {
		this.setId(id);
		this.isOccupied = false;
                orders = new ArrayList<Order>();
	}
	
	public Table(int id, int numseats) {
		this.setId(id);
		this.setNumSeats(numseats);
		this.setOccupied(false);
                orders = new ArrayList<Order>();
	}
	
	public Table(int id, int numseats, boolean occupied, int pin) {
		this.setId(id);
		this.setNumSeats(numseats);
		this.setOccupied(occupied);
		this.setPin(pin);
                orders = new ArrayList<Order>();
	}

	
	public Table getTable() {
		return this;
	}
	
	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

    public ArrayList<Order> getAllTablesOrders() {
		return orders;
	}

    public void addOrder(Order o) {
        orders.add(o);
    }
    
    public void clearOrders() {
    	orders.removeAll(orders);
    }

	public int getNumSeats() {
		return numSeats;
	}

	public void setNumSeats(int numSeats) {
		this.numSeats = numSeats;
	}


	public boolean isOccupied() {
		return isOccupied;
	}

	public void setOccupied(boolean isOccupied) {
		this.isOccupied = isOccupied;
	}

	public int getPin() {
		return pin;
	}

	public void setPin(int pin) {
		this.pin = pin;
	}

	@Override
	public void update(Observable o, Object arg) {
		// TODO NOTIFY CUSTOMER QUE OF FREE TABLE
	}
	
}
